import subprocess
import os

# 获取当前工作目录

def GET_WS_CALLBACK(    
    server_addr = 'localhost',
    server_port = '6066',
    wave_filename = ''):

    current_dir = os.getcwd()

    command = [
        'python3', os.path.join(current_dir, 'offline-websocket-client-decode-files-paralell.py'),
        '--server-addr', 'localhost',
        '--server-port', '6006',
        wave_filename
    ]

    print("Executing command:", " ".join(command))

    try:
        result = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
        # print("STDOUT:", result.stdout)
    except subprocess.CalledProcessError as e:
        print("STDERR:", e.stderr)
        # pass

    return result.stdout


print(GET_WS_CALLBACK(wave_filename = './8k.wav'))


